<template>
  <div>
    <el-button type="primary" @click="getlongson()">得到最长子序列</el-button>
    <el-button type="primary" @click="add()">加</el-button>

    <p>{{ store.count }}</p>
  </div>
</template>

<script setup>
import { ref, reactive, toRefs, onBeforeMount, onMounted, watchEffect, computed, getCurrentInstance } from 'vue';
import { useCounterStore } from '@/stores/counter'
onMounted(() => {
  // getradiusArray()
})
const store = useCounterStore()
const getradiusArray = () => {
  // for (let i = 1; i < 15; i++) {
  //   radiusArray.value.push(Math.floor((Math.random() * 10) + 1));
  // }
}

const timArray = ref([])

const getlongson = () => {
  const my = [4, 5, 8, 2, 7, 3, 6, 1]
  const resultArr = [[my[0]]]
  console.log(resultArr)

  for (let i = 1; i < my.length; i++) {
    let n = my[i]


    for (let j = resultArr.length - 1; j >= 0; j--) {
      const line = resultArr[j]
      const tail = line[line.length - 1]

      if (n > tail) {
        resultArr[j + 1] = [...line, n]
        break
      }
    }
    console.log(resultArr)
    resultArr[0] = [n]
  }
  console.log(resultArr[resultArr.length - 1])
  // return resultArr[resultArr.length-1]
}
const add = () => {
  store.increment()
  store.getthis()
  
}
</script>
<style scoped lang='less'></style>